/*  
     PlAr is Platform Arena: a 2D multiplayer shooting game
     Copyright (c) 2009 Ragagnin Antonio <spocchio@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package res.levels;


import java.awt.Point;
import java.awt.Polygon;

import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.Body;

import plar.core.Common;
import plar.core.Element;
import plar.core.Level;
import res.elements.Block;
import res.elements.Ammo;
import res.elements.Thorn;
import res.elements.Health;
import res.elements.Platform;
import res.elements.Elevator;
import plar.core.SpawnPoint;
import org.jbox2d.collision.*;


public class Level0 extends Level implements Runnable {

	int tile = 45;

	public Level0() {
		super(new Vec2(500,500),new Vec2(0,9.8f));
	
	}
	public void Initialize(){
		super.Initialize();
	
	{
		addBlock("A",1,0);
addBlock("x",2,0);
addBlock("x",3,0);
addBlock("x",4,0);
addBlock("x",5,0);
addBlock("x",6,0);
addBlock("x",7,0);
addBlock("x",8,0);
addBlock("x",9,0);
addBlock("x",10,0);
addBlock("x",11,0);
addBlock("x",12,0);
addBlock("x",13,0);
addBlock("x",14,0);
addBlock("x",15,0);
addBlock("x",16,0);
addBlock("x",17,0);
addBlock("x",18,0);
addBlock("x",19,0);
addBlock("x",20,0);
addBlock("x",21,0);
addBlock("x",22,0);
addBlock("x",23,0);
addBlock("x",24,0);
addBlock("x",25,0);
addBlock("x",26,0);
addBlock("x",27,0);
addBlock("x",28,0);
addBlock("x",29,0);
addBlock("x",30,0);
addBlock("x",31,0);
addBlock("x",32,0);
addBlock("x",33,0);
addBlock("x",34,0);
addBlock("x",35,0);
addBlock("x",36,0);
addBlock("x",37,0);

addBlock("x",15,0);
addBlock("x",16,0);
addBlock("x",17,0);
addBlock("x",18,0);
addBlock("x",19,0);
addBlock("x",20,0);
addBlock("x",21,0);
addBlock("x",22,0);
addBlock("x",23,0);
addBlock("x",24,0);
addBlock("x",25,0);
addBlock("x",26,0);
addBlock("x",27,0);
addBlock("x",28,0);
addBlock("x",29,0);
addBlock("x",30,0);
addBlock("x",31,0);
addBlock("x",32,0);
addBlock("x",33,0);
addBlock("x",34,0);
addBlock("x",35,0);
addBlock("x",36,0);
addBlock("x",37,0);

addBlock("B",141,0);
addBlock("|",1,1);
addBlock("|",141,1);
addBlock("|",1,2);
addBlock("S",3,2);
addBlock("|",141,2);
addBlock("|",1,3);
addBlock("S",130,3);
addBlock("|",141,3);
addBlock("|",1,4);
addBlock("|",141,4);
addBlock("|",1,5);
addBlock("a",8,5);
addBlock("h",43,5);
addBlock("|",141,5);
addBlock("C",1,6);
addBlock("x",2,6);
addBlock("x",3,6);
addBlock("x",4,6);
addBlock("x",5,6);
addBlock("x",6,6);
addBlock("x",7,6);
addBlock("x",8,6);
addBlock("x",9,6);
addBlock("x",10,6);
addBlock("x",11,6);
addBlock("x",12,6);
addBlock("x",13,6);
addBlock("x",14,6);
addBlock("x",15,6);
addBlock("x",16,6);
addBlock("x",17,6);
addBlock("x",18,6);
addBlock("x",19,6);
addBlock("x",20,6);
addBlock("B",21,6);
addBlock("A",30,6);
addBlock("x",31,6);
addBlock("x",32,6);
addBlock("x",33,6);
addBlock("x",34,6);
addBlock("x",35,6);
addBlock("x",36,6);
addBlock("x",37,6);
addBlock("x",38,6);
addBlock("x",39,6);
addBlock("x",40,6);
addBlock("x",41,6);
addBlock("x",42,6);
addBlock("x",43,6);
addBlock("x",44,6);
addBlock("x",45,6);
addBlock("x",46,6);
addBlock("x",47,6);
addBlock("x",48,6);
addBlock("x",49,6);
addBlock("x",50,6);
addBlock("x",51,6);
addBlock("x",52,6);
addBlock("x",53,6);
addBlock("x",54,6);
addBlock("x",55,6);
addBlock("x",56,6);
addBlock("x",57,6);
addBlock("x",58,6);
addBlock("x",59,6);
addBlock("x",60,6);
addBlock("]",61,6);

addBlock("b",121,6.5f);

addBlock("h",122,6);
addBlock("a",137,6);
addBlock("a",138,6);
addBlock("a",139,6);
addBlock("|",141,6);
addBlock("|",21,7);
addBlock("|",30,7);
addBlock("[",61,7);
addBlock("x",62,7);
addBlock("]",63,7);
addBlock("[",118,7);
addBlock("x",119,7);
addBlock("x",120,7);
addBlock("x",121,7);
addBlock("x",122,7);
addBlock("x",123,7);
addBlock("x",124,7);
addBlock("x",125,7);
addBlock("x",126,7);
addBlock("x",127,7);
addBlock("x",128,7);
addBlock("x",129,7);
addBlock("x",130,7);
addBlock("x",131,7);
addBlock("x",132,7);
addBlock("x",133,7);
addBlock("x",134,7);
addBlock("x",135,7);
addBlock("x",136,7);
addBlock("x",137,7);
addBlock("x",138,7);
addBlock("x",139,7);
addBlock("x",140,7);
addBlock("|",141,7);
addBlock("|",21,8);
addBlock("|",30,8);
addBlock("[",63,8);
addBlock("x",64,8);
addBlock("]",65,8);
addBlock("h",86,8);
addBlock("[",116,8);
addBlock("x",117,8);
addBlock("]",118,8);
addBlock("|",141,8);
addBlock("|",21,9);
addBlock("|",30,9);
addBlock("S",38,9);
addBlock("a",44,9);
addBlock("[",65,9);
addBlock("x",66,9);
addBlock("]",67,9);
addBlock("~",78,9);
addBlock("~",82,9);
addBlock("~",86,9);
addBlock("~",90,9);
addBlock("~",94,9);
addBlock("[",114,9);
addBlock("x",115,9);
addBlock("]",116,9);
addBlock("|",141,9);
addBlock("|",21,10);
addBlock("|",30,10);
addBlock("[",43,10);
addBlock("x",44,10);
addBlock("]",45,10);
addBlock("[",66,10);
addBlock("x",67,10);
addBlock("x",68,10);
addBlock("x",69,10);
addBlock("x",70,10);
addBlock("]",71,10);
addBlock("[",72,10);
addBlock("x",73,10);
addBlock("]",74,10);
addBlock("[",111,10);
addBlock("x",112,10);
addBlock("]",113,10);
addBlock("h",139,10);
addBlock("a",140,10);
addBlock("|",141,10);
addBlock("|",21,11);
addBlock("|",30,11);
addBlock("[",36,11);
addBlock("x",37,11);
addBlock("x",38,11);
addBlock("x",39,11);
addBlock("]",40,11);
addBlock("[",99,11);
addBlock("x",100,11);
addBlock("x",101,11);
addBlock("x",102,11);
addBlock("x",103,11);
addBlock("x",104,11);
addBlock("x",105,11);
addBlock("x",106,11);
addBlock("x",107,11);
addBlock("]",108,11);
addBlock("[",138,11);
addBlock("x",139,11);
addBlock("x",140,11);
addBlock("|",141,11);
addBlock("|",21,12);
addBlock("|",141,12);
addBlock("|",21,13);
addBlock("a",94,13);
addBlock("[",95,13);
addBlock("x",96,13);
addBlock("x",97,13);
addBlock("]",98,13);
addBlock("|",141,13);
addBlock("|",21,14);
addBlock("a",35,15);
addBlock("[",93,14);
addBlock("x",94,14);
addBlock("]",95,14);
addBlock("[",131,14);
addBlock("x",132,14);
addBlock("x",133,14);
addBlock("x",134,14);
addBlock("]",135,14);
addBlock("|",141,14);
addBlock("|",21,15);
addBlock("[",46,15);
addBlock("x",47,15);
addBlock("x",48,15);
addBlock("]",49,15);
addBlock("[",54,15);
addBlock("x",55,15);
addBlock("x",56,15);
addBlock("x",57,15);
addBlock("x",58,15);
addBlock("x",59,15);
addBlock("x",60,15);
addBlock("x",61,15);
addBlock("x",62,15);
addBlock("x",63,15);
addBlock("x",64,15);
addBlock("]",65,15);
addBlock("~",68,15);
addBlock("|",141,15);
addBlock("|",21,16);
addBlock("x",22,16);
addBlock("]",23,16);
addBlock("[",41,16);
addBlock("x",42,16);
addBlock("x",43,16);
addBlock("x",44,16);
addBlock("x",45,16);
addBlock("x",46,16);
addBlock("x",47,16);
addBlock("x",48,16);

addBlock("b",85,16.5f);
//addBlock("b",86,16.5f);
//addBlock("b",87,16.5f);
addBlock("b",93,16.5f);
//addBlock("b",85,16);

addBlock("]",49,16);
addBlock("h",140,16);
addBlock("|",141,16);
addBlock("D",21,17);
addBlock("x",22,17);
addBlock("x",23,17);
addBlock("x",24,17);
addBlock("x",25,17);
addBlock("x",26,17);
addBlock("x",27,17);
addBlock("x",28,17);
addBlock("x",29,17);
addBlock("x",30,17);
addBlock("x",31,17);
addBlock("x",32,17);
addBlock("x",33,17);
addBlock("x",34,17);
addBlock("x",35,17);
addBlock("x",36,17);
addBlock("x",37,17);
addBlock("x",38,17);
addBlock("x",39,17);
addBlock("x",40,17);
addBlock("x",41,17);
addBlock("x",42,17);
addBlock("x",43,17);
addBlock("x",44,17);
addBlock("x",45,17);
addBlock("x",46,17);
addBlock("x",47,17);
addBlock("x",48,17);
addBlock("]",49,17);
addBlock("[",70,17);
addBlock("x",71,17);
addBlock("x",72,17);
addBlock("x",73,17);
addBlock("x",74,17);
addBlock("x",75,17);
addBlock("x",76,17);
addBlock("x",77,17);
addBlock("x",78,17);
addBlock("]",79,17);
addBlock("^",80,17);
addBlock("^",81,17);
addBlock("[",82,17);
addBlock("x",83,17);
addBlock("x",84,17);
addBlock("x",85,17);
addBlock("x",86,17);
addBlock("x",87,17);
addBlock("x",88,17);
addBlock("x",89,17);
addBlock("x",90,17);
addBlock("x",91,17);
addBlock("x",92,17);
addBlock("x",93,17);
addBlock("x",94,17);
addBlock("x",95,17);
addBlock("]",96,17);
addBlock("^",97,17);
addBlock("^",98,17);
addBlock("^",99,17);
addBlock("^",100,17);
addBlock("^",101,17);
addBlock("^",102,17);
addBlock("^",103,17);
addBlock("[",104,17);
addBlock("x",105,17);
addBlock("x",106,17);
addBlock("x",107,17);
addBlock("x",108,17);
addBlock("x",109,17);
addBlock("x",110,17);
addBlock("x",111,17);
addBlock("x",112,17);
addBlock("]",113,17);
addBlock("^",114,17);
addBlock("^",115,17);
addBlock("^",116,17);
addBlock("[",117,17);
addBlock("x",118,17);
addBlock("x",119,17);
addBlock("x",120,17);
addBlock("x",121,17);
addBlock("x",122,17);
addBlock("x",123,17);
addBlock("x",124,17);
addBlock("x",125,17);
addBlock("]",126,17);
addBlock("^",127,17);
addBlock("^",128,17);
addBlock("^",129,17);
addBlock("^",130,17);
addBlock("^",131,17);
addBlock("^",132,17);
addBlock("^",133,17);
addBlock("^",134,17);
addBlock("^",135,17);
addBlock("^",136,17);
addBlock("^",137,17);
addBlock("^",138,17);
addBlock("[",139,17);
addBlock("x",140,17);
addBlock("|",141,17);
addBlock("|",49,18);
addBlock("|",70,18);
addBlock("|",49,19);
addBlock("|",70,19);
addBlock("C",49,20);
addBlock("^",50,20);
addBlock("^",51,20);
addBlock("^",52,20);
addBlock("^",53,20);
addBlock("^",54,20);
addBlock("^",55,20);
addBlock("^",56,20);
addBlock("^",57,20);
addBlock("^",58,20);
addBlock("^",59,20);
addBlock("^",60,20);
addBlock("^",61,20);
addBlock("^",62,20);
addBlock("^",63,20);
addBlock("^",64,20);
addBlock("^",65,20);
addBlock("^",66,20);
addBlock("^",67,20);
addBlock("^",68,20);
addBlock("^",69,20);
addBlock("D",70,20);

		}
	}
	public void addBlock(String type,float x,float y)
	{
		Block b=new Block();
		b.setPosition(x/2,y);
		b.setSize(0.5f,1.1f);
		if(type=="x")
		{
			//b.setSize(0.5f,1.1f);
			b.setStaticSprite("res/elements/block/blockm.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
			if(type=="b")
		{
			b.setSize(0.5f,0.5f);
			b.setStaticSprite("res/elements/boxino.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="S")
		{
			SpawnPoint s = new SpawnPoint();
			s.setPosition(x/2,y);
			AddElement(s);
		}
		if(type=="[")
		{
			//b.setSize(0.3f,1.1f);
			b.setStaticSprite("res/elements/block/blockl.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			b.setProperty("friction",0f);
			AddElement(b);
		}
		if(type=="]")
		{
			//b.setSize(0.3f,1.1f);
			b.setProperty("friction",0f);
			b.setStaticSprite("res/elements/block/blockr.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="|")
		{
			b.setProperty("friction",0f);
			//b.setSize(0.25f,1.1f);
			b.setStaticSprite("res/elements/block/blockcr.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="A")
		{
			//b.setSize(0.25f,1.1f);
			b.setStaticSprite("res/elements/block/blockctl.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="B")
		{
			//b.setSize(0.25f,1.1f);
			b.setStaticSprite("res/elements/block/blockctr.png");
			b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="C")
		{
			//b.setSize(0.25f,1.1f);
			b.setStaticSprite("res//elements/block/blockcbr.png");
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		if(type=="D")
		{
			//b.setSize(0.25f,1.1f);
			b.setStaticSprite("res/elements/block/blockcbl.png");
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(b);
		}
		
		if(type=="a")
		{
			//b.setSize(0.25f,1.1f);
			Ammo a = new Ammo();
			a.setStaticSprite("res/elements/gun.png");
			a.setPosition(x/2,y);
			a.setProperty("friction",0f);
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(a);
		}
		if(type=="h")
		{
			Health a = new Health();
			a.setStaticSprite("res/elements/h.png");
			a.setPosition(x/2,y);
			a.setProperty("friction",0f);
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(a);
		}
		
		if(type=="^")
		{
			Thorn a = new Thorn();
			a.setStaticSprite("res/elements/triangle.png");
			
			a.setPosition(x/2,y);
			a.setProperty("friction",0f);
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(a);
		}
			if(type=="~")
		{
			Platform a = new Platform();
			a.setStaticSprite("res/elements/elevator.png");
			a.getCurrentSpriteSet().get(0).offsety = -0.08f;
			a.setPosition(x/2,y);
			a.setSize(2,0.2f);
			
			a.setProperty("centralPosition",new Vec2(x/2,y));
			a.setProperty("friction",0f);
			//b.getCurrentSpriteSet().get(0).offsety = -0.1f;
			AddElement(a);
		}
		
			
		
	}
	public void run() {
		super.run();
		Double x = Math.random();
		

	}
}

